package com.wk;

import com.wk.service.MailService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author 王珂
 * @date 2020/7/20 23:49
 */

@SpringBootTest
@RunWith(SpringRunner.class)
public class RabbitMQ {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Autowired
    private MailService mailService;


    @Test
    public void testHello(){
        for (int i= 0;i<50;i++){
            rabbitTemplate.convertAndSend("hello","hello world");
        }
    }

    @Test
    public void test2(){
        mailService.sendMsgToMq("测试邮件发送");
    }
}
